<?php
namespace app\admin\controller;

use app\BaseController;
use think\App;
use think\facade\Cache;
use app\common\model\SuperUser as SuperUserModel;
use app\common\model\Role as RoleModel;
use app\common\model\Menu as MenuModel;
use hg\apidoc\annotation as Apidoc;

/**
 * @Apidoc\Title("Base")
 * @Apidoc\Group("AdminBaseController")
 * @Apidoc\Sort("1")
 */

class AdminBaseController extends BaseController
{
    protected $super_user_model;
    protected $role_model;
    protected $menu_model;
    // 登陆用户信息
    protected $super_user_auth;
    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->super_user_model = new SuperUserModel();
        $this->role_model = new RoleModel();
        $this->menu_model = new MenuModel();
        $username = $this->request->header('token') 
        ? Cache::store('redis')->get($this->request->header('token')) : '';
        $this->super_user_auth = $username ? Cache::store('redis')->get($username) : '';
    }
}
